var path = $("#path").val();
$(function() {
    $('#open').bootstrapTable({
        type: "GET",
        striped: true,
        singleSelect: false,
        url: path+"/ReleseJopopen.json",
        dataType: "json",
        pagination: true, //分页
        pageSize: 10,
        pageNumber: 1,
        search: false, //显示搜索框
        contentType: "application/x-www-form-urlencoded",
        queryParams: null,
        columns: [
        	{
				title : "选择",
                checkbox:"true",
                align: 'center',
                valign: 'middle'
            },
            {
                visible:false,//隐藏列
                field: 'id',
                align: 'center',
                valign: 'middle'
            },
            
            {
                title: "职位编码",
                field: 'position_code',
                align: 'center',
                valign: 'middle'
            },
            {
                title: '职位名称',
                field: 'position_name',
                align: 'center',
                valign: 'middle'
            },
            {
                title: '职位分类',
                field: 'posClassName',
                align: 'center'
            },
            {
                title: '所属部门',
                field: 'department',
                align: 'center'
            },
                     
            
        ]
    });
    
});
function open() {
    $.ajax({
        type: "GET",
        url: path+"/ReleseJopopen.json",
        dataType: "json",
        success: function (result) {
            if (result.data) {
                var TableData = result.data;
                $('#table').bootstrapTable("load", TableData);
            }
        }
    })
}
function openlayer(){
	var path = $("#path").val();
			layer.open({
		        type: 1,
		        title: '职位列表',
		        shadeClose: false,
		        shade: 0.5,
		        skin: 'layui-layer-rim',
//		        maxmin: true,
		        area: ['90%', '90%'],
		        shadeClose: false,
		        content: $("#layerOpen")
		        //iframe的url
		    });
} 

function openlayer_resume(rt_id){
	
	document.getElementById("ResumeID").value = rt_id;
	var path = $("#path").val();
			layer.open({
		        type: 1,
		        title: '职位列表',
		        shadeClose: false,
		        shade: 0.5,
		        skin: 'layui-layer-rim',
//		        maxmin: true,
		        area: ['90%', '90%'],
		        shadeClose: false,
		        content: $("#layerOpen")
		        //iframe的url
		    });
} 
$(document).on('click', '#close', function() {
	  var re_positionId=null;
	 var row = $.map($('#open').bootstrapTable('getSelections'),function (row) {
		 	var postName=row["position_name"];//职位名称
			var p_class=row["posClassName"];//职位分类名称
			var p_code=row["position_code"];//职位编码
			 re_positionId = row["id"];//职位名称id
			document.getElementById("rt_p_classname").value = p_class;//职位分类名称
			document.getElementById("rt_position_name").value = postName;//职位名称
			document.getElementById("rt_position_code").value = p_code; //职位编码
			document.getElementById("re_positionId").value = re_positionId;//职位名称id
  })
	  layer.closeAll();
});


$(document).on('click', '#closere', function() {
	
	
	var id=$('#ResumeID').val();//简历id
	
	 var row = $.map($('#open').bootstrapTable('getSelections'),function (row) {
		 var  re_positionId = row["id"];//职位名称id	
	 
	 $.ajax({
		 type:"GET",
		 url:path+"/AddEmployJob.json",
		 dataType:"json",
		 data:{
			 "id":id,
			 "postId":re_positionId
		 },
		 success:function(result){
			 if(result.data){
				 var TableData =result.data;
				 if(TableData){
					 layer.closeAll();
					 $('#table').bootstrapTable("refresh", TableData);
				 }
			 }
		 }
	 })
	 
	 });
	
})
